# Copyright (C) Kumo inc. and its affiliates.
# Author: Jeff.li lijippy@163.com
# All rights reserved.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <https:#www.gnu.org/licenses/>.
#

set(BENCHMARK_DEPENDENCIES_NO_FUNC
    pollux_functions_test_lib
    pollux_exec
    pollux_exec_test_lib
    Melon::melon
    Melon::melonbenchmark
    pollux_benchmark_builder)

set(BENCHMARK_DEPENDENCIES
    pollux_functions_prestosql pollux_functions_lib pollux_vector_fuzzer
    ${BENCHMARK_DEPENDENCIES_NO_FUNC})

add_executable(pollux_functions_prestosql_benchmarks_array_contains
               ArrayContainsBenchmark.cpp)
target_link_libraries(
  pollux_functions_prestosql_benchmarks_array_contains ${BENCHMARK_DEPENDENCIES})

add_executable(pollux_functions_prestosql_benchmarks_array_min_max
               ArrayMinMaxBenchmark.cpp)
target_link_libraries(
  pollux_functions_prestosql_benchmarks_array_min_max ${BENCHMARK_DEPENDENCIES})

add_executable(pollux_functions_prestosql_benchmarks_array_position
               ArrayPositionBenchmark.cpp)
target_link_libraries(
  pollux_functions_prestosql_benchmarks_array_position ${BENCHMARK_DEPENDENCIES})

add_executable(pollux_functions_prestosql_benchmarks_array_sum
               ArraySumBenchmark.cpp)

target_link_libraries(
  pollux_functions_prestosql_benchmarks_array_sum ${BENCHMARK_DEPENDENCIES})

add_executable(pollux_functions_prestosql_benchmarks_field_reference
               FieldReferenceBenchmark.cpp)
target_link_libraries(
  pollux_functions_prestosql_benchmarks_field_reference
  ${BENCHMARK_DEPENDENCIES})

add_executable(pollux_functions_prestosql_benchmarks_width_bucket
               WidthBucketBenchmark.cpp)
target_link_libraries(
  pollux_functions_prestosql_benchmarks_width_bucket ${BENCHMARK_DEPENDENCIES})

add_executable(pollux_functions_prestosql_benchmarks_string_ascii_utf_functions
               StringAsciiUTFFunctionBenchmarks.cpp)
target_link_libraries(
  pollux_functions_prestosql_benchmarks_string_ascii_utf_functions
  ${BENCHMARK_DEPENDENCIES} pollux_common_fuzzer_util)

add_executable(pollux_functions_prestosql_benchmarks_not NotBenchmark.cpp)
target_link_libraries(
  pollux_functions_prestosql_benchmarks_not ${BENCHMARK_DEPENDENCIES})

add_executable(pollux_functions_prestosql_benchmarks_date_time
               DateTimeBenchmark.cpp)
target_link_libraries(
  pollux_functions_prestosql_benchmarks_date_time pollux_type_tz
  ${BENCHMARK_DEPENDENCIES})

add_executable(pollux_functions_prestosql_benchmarks_bitwise
               BitwiseBenchmark.cpp)
target_link_libraries(
  pollux_functions_prestosql_benchmarks_bitwise ${BENCHMARK_DEPENDENCIES})

add_executable(pollux_functions_prestosql_benchmarks_in InBenchmark.cpp)
target_link_libraries(
  pollux_functions_prestosql_benchmarks_in ${BENCHMARK_DEPENDENCIES})

add_executable(pollux_functions_prestosql_benchmarks_map_input
               MapInputBenchmark.cpp)
target_link_libraries(
  pollux_functions_prestosql_benchmarks_map_input ${BENCHMARK_DEPENDENCIES})

add_executable(pollux_functions_benchmarks_url URLBenchmark.cpp)
target_link_libraries(
  pollux_functions_benchmarks_url ${BENCHMARK_DEPENDENCIES})

add_executable(pollux_functions_benchmarks_compare CompareBenchmark.cpp)
target_link_libraries(
  pollux_functions_benchmarks_compare ${BENCHMARK_DEPENDENCIES})

add_executable(pollux_benchmark_array_writer_with_nulls ArrayWriterBenchmark.cpp)
target_compile_definitions(pollux_benchmark_array_writer_with_nulls
                           PUBLIC WITH_NULLS=true)
target_link_libraries(
  pollux_benchmark_array_writer_with_nulls ${BENCHMARK_DEPENDENCIES_NO_FUNC})

add_executable(pollux_benchmark_array_writer_no_nulls ArrayWriterBenchmark.cpp)
target_link_libraries(
  pollux_benchmark_array_writer_no_nulls ${BENCHMARK_DEPENDENCIES_NO_FUNC})
target_compile_definitions(pollux_benchmark_array_writer_no_nulls
                           PUBLIC WITH_NULLS=false)

add_executable(pollux_benchmark_nested_array_writer_no_nulls
               NestedArrayWriterBenchmark.cpp)
target_link_libraries(
  pollux_benchmark_nested_array_writer_no_nulls
  ${BENCHMARK_DEPENDENCIES_NO_FUNC})
target_compile_definitions(pollux_benchmark_nested_array_writer_no_nulls
                           PUBLIC WITH_NULLS=false)

add_executable(pollux_benchmark_nested_array_writer_with_nulls
               NestedArrayWriterBenchmark.cpp)
target_compile_definitions(pollux_benchmark_nested_array_writer_with_nulls
                           PUBLIC WITH_NULLS=true)
target_link_libraries(
  pollux_benchmark_nested_array_writer_with_nulls
  ${BENCHMARK_DEPENDENCIES_NO_FUNC})

add_executable(pollux_benchmark_map_writer_with_nulls MapWriterBenchmarks.cpp)
target_compile_definitions(pollux_benchmark_map_writer_with_nulls
                           PUBLIC WITH_NULLS=true)
target_link_libraries(
  pollux_benchmark_map_writer_with_nulls ${BENCHMARK_DEPENDENCIES_NO_FUNC})

add_executable(pollux_benchmark_map_writer_no_nulls MapWriterBenchmarks.cpp)
target_link_libraries(
  pollux_benchmark_map_writer_no_nulls ${BENCHMARK_DEPENDENCIES_NO_FUNC})
target_compile_definitions(pollux_benchmark_map_writer_no_nulls
                           PUBLIC WITH_NULLS=false)

add_executable(pollux_functions_benchmarks_row_writer_no_nulls
               RowWriterBenchmark.cpp)
target_link_libraries(
  pollux_functions_benchmarks_row_writer_no_nulls
  ${BENCHMARK_DEPENDENCIES_NO_FUNC})

add_executable(pollux_functions_benchmarks_string_writer_no_nulls
               StringWriterBenchmark.cpp)
target_link_libraries(
  pollux_functions_benchmarks_string_writer_no_nulls
  ${BENCHMARK_DEPENDENCIES_NO_FUNC})

add_executable(pollux_functions_prestosql_benchmarks_zip ZipBenchmark.cpp)
target_link_libraries(
  pollux_functions_prestosql_benchmarks_zip ${BENCHMARK_DEPENDENCIES})

add_executable(pollux_functions_prestosql_benchmarks_row Row.cpp)
target_link_libraries(
  pollux_functions_prestosql_benchmarks_row ${BENCHMARK_DEPENDENCIES})

add_executable(pollux_functions_prestosql_benchmarks_comparisons
               ComparisonsBenchmark.cpp)
target_link_libraries(
  pollux_functions_prestosql_benchmarks_comparisons ${BENCHMARK_DEPENDENCIES})

add_executable(pollux_functions_prestosql_benchmarks_concat ConcatBenchmark.cpp)
target_link_libraries(
  pollux_functions_prestosql_benchmarks_concat ${BENCHMARK_DEPENDENCIES})

add_executable(pollux_functions_prestosql_benchmarks_zip_with
               ZipWithBenchmark.cpp)
target_link_libraries(
  pollux_functions_prestosql_benchmarks_zip_with ${BENCHMARK_DEPENDENCIES})

add_executable(pollux_functions_prestosql_benchmarks_map_zip_with
               MapZipWithBenchmark.cpp)
target_link_libraries(
  pollux_functions_prestosql_benchmarks_map_zip_with ${BENCHMARK_DEPENDENCIES})

add_executable(pollux_functions_prestosql_benchmarks_cardinality
               CardinalityBenchmark.cpp)
target_link_libraries(
  pollux_functions_prestosql_benchmarks_cardinality ${BENCHMARK_DEPENDENCIES})

add_executable(pollux_functions_benchmarks_simdjson_function_with_expr
               JsonExprBenchmark.cpp)
target_link_libraries(
  pollux_functions_benchmarks_simdjson_function_with_expr
  ${BENCHMARK_DEPENDENCIES})

add_executable(pollux_functions_prestosql_benchmarks_map_subscript
               MapSubscriptCachingBenchmark.cpp)
target_link_libraries(
  pollux_functions_prestosql_benchmarks_map_subscript ${BENCHMARK_DEPENDENCIES})

add_executable(pollux_functions_prestosql_benchmarks_regexp_replace
               RegexpReplaceBenchmark.cpp)
target_link_libraries(
  pollux_functions_prestosql_benchmarks_regexp_replace ${BENCHMARK_DEPENDENCIES})

add_executable(pollux_functions_prestosql_benchmarks_generic
               GenericBenchmark.cpp)
target_link_libraries(
  pollux_functions_prestosql_benchmarks_generic ${BENCHMARK_DEPENDENCIES})

add_executable(pollux_functions_prestosql_benchmarks_uuid_cast
               UuidCastBenchmark.cpp)
target_link_libraries(
  pollux_functions_prestosql_benchmarks_uuid_cast ${BENCHMARK_DEPENDENCIES})
